package com.gamejelly.broker.message;

import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Getter
@Setter
@Accessors(chain = true)
public class RpcMessage extends BaseMsg implements Serializable {

    @NonNull
    CmdInfo cmdInfo;

    RpcInfo rpcInfo;

    byte[] data;

    public String findTarget() {
        if (rpcInfo == null || !rpcInfo.isCallBack()) {
            return cmdInfo.endPoint;
        } else {
            return rpcInfo.getSource();
        }
    }

}
